<?php
class ControllerSAdminModelmenu extends Controller {
	public $m_control_venue = null;

	public $m_venue_id          = 1;
	public $m_root_mask        = null;

 	public function index() {
		$this->template = '/template/s_admin/model/menu.html';
		
		if (isset($this->request->get ['id']))
		{
			$this->m_venue_id = $this->request->get ['id'];
		}
		else
		{
				header ( "Location: index.php?route=error/not_found" );
		}
		$this->load->model('gym/gym');

		// 通用权限判断
		$admin = $this->model_gym_gym->getBusiness(array('originParameter' => $this->m_venue_id,'originID' => 1130, 'accountId' => $this->member->getId(), 'status' => 1));
		
		if( !$admin )
		{
			$this->redirect($this->url->link('error/not_found/noAccess'));
		}
		
		// 单项操作判断
		$item =  str_replace('s_admin/', '', $this->request->get['route']);

		$this->load->config('param');
		$this->m_root_mask = $this->config->get('s_adminRootMask');  // 权限
		
		if (isset($this->m_root_mask[$item]))
		{
			if(!judgeAccess(intval($admin[0]['rootMask']), $this->m_root_mask[$item]))
			{
			
				$this->redirect($this->url->link('error/not_found/noAccess'));
			}
		}
		
		

		$this->load->model('sport/venue');
		$this->m_control_venue             = $this->model_sport_venue;
		
		$this->load->model('album/photo');
		$this->m_control_photo              = $this->model_album_photo;
		
		$venue_info = $this->m_control_venue->getVenue($this->m_venue_id);
		$img = $this->model_album_photo->getPhoto($venue_info['iconID']);
		
		$this->data['venue_menu'] = array(
				'name' => $venue_info['name'],
				'imgUrl' => createImageSizeUrl($img,150),
		);
		
		$this->data['venueID'] = $venueID = $this->m_venue_id;
		$this->data['submenus'] = $this->document->getSubmenu();
		$this->render();
	}
}
?>
